package io.kimmking.common.rocketmq.base;

import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.SelectorType;

import java.lang.annotation.*;

@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RocketMQMsgListener {

//    String consumerGroup();

//    String topic();

    /**
     * 查询类型 SelectorType.TAG根据tag查询   SelectorType.SQL92根据sql查询
     * @return
     */
    SelectorType selectorType() default SelectorType.TAG;

    /**
     * tag，订阅子查询条件，默认获取所有
     * @return
     */
    String selectorExpression() default "*";

    ConsumeMode consumeMode() default ConsumeMode.CONCURRENTLY;

    /**
     * 控制消息模式，如果希望所有订阅者都接收消息全部消息，广播是一个不错的选择。如果希望一个消费者接收则使用集群模式
     * @return
     */
    MessageModel messageModel() default MessageModel.CLUSTERING;

    int consumeThreadMax() default 64;

    long consumeTimeout() default 15L;

    String accessKey() default "${rocketmq.consumer.access-key:}";

    String secretKey() default "${rocketmq.consumer.secret-key:}";

    boolean enableMsgTrace() default true;

    String customizedTraceTopic() default "${rocketmq.consumer.customized-trace-topic:}";

    String nameServer() default "${rocketmq.name-server:}";

    String accessChannel() default "${rocketmq.access-channel:}";
}
